The buttonStyle
property allows you to customize the interaction behavior and appearance of buttons within a view hierarchy in your UI.
The buttonStyle
property applies a specific style to all buttons within a view hierarchy, enabling you to customize their appearance and interaction behavior.
The buttonStyle
property accepts the following string values:
automatic
: The default button style, adapting to the button’s context.bordered
: Applies standard border artwork based on the button’s context.borderedProminent
: Applies prominent border artwork for buttons.borderless
: A style that doesn’t apply a border.plain
: A style that avoids decoration while idle but may indicate the button's pressed, focused, or enabled state visually.If buttonStyle
is not specified, the default style (automatic
) is applied based on the button’s context.
Here’s how you can apply the buttonStyle
property in your TypeScript code:
This creates a button with a standard border.
This creates a button without any border.
This creates a button that does not decorate its content while idle but visually indicates interaction states.
buttonStyle
property directly maps to SwiftUI’s buttonStyle
modifier.